package cloud.simple.service.k8s.actuator;

import cloud.simple.service.k8s.probe.K8sProbeChecker;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;

@RequiredArgsConstructor
@RequestMapping("/k8s/ha")
@RestController
public class K8sHaActuator {

    private final K8sProbeChecker k8sProbeChecker;

    @RequestMapping(value = "startup", method = RequestMethod.GET)
    public void startup(HttpServletResponse response) {
        response.setStatus(k8sProbeChecker.startup());
    }

    @RequestMapping(value = "readiness", method = RequestMethod.GET)
    public void readiness(HttpServletResponse response) {
        response.setStatus(k8sProbeChecker.readiness());
    }

}
